package com.ruoyi.system.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.utils.HangyeUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * 行业管理对象 sys_hangye
 *
 * @author shuyan
 * @date 2020-12-30
 */
@Data
@ToString
@EqualsAndHashCode
@NoArgsConstructor
@Accessors(chain = true)
@TableName("sys_hangye")
public class SysHangye implements Serializable {

    private static final long serialVersionUID = 1L;


    /**
     * 主键
     */
    @TableId(value = "id")
    private Long id;

    /**
     * 行业名称
     */
    @Excel(name = "行业名称")
    private String name;

    /**
     * 行业代码
     */
    @Excel(name = "行业代码")
    private String code;

    /**
     * 行业级别
     */
    @Excel(name = "行业级别")
    private Integer level;

    /**
     * 父级代码
     */
    @Excel(name = "父级代码")
    private String parentCode;

    /**
     * 行业大类
     */
    private String code1;

    /**
     * 行业中类
     */
    private String code2;

    /**
     * 行业小类
     */
    private String code3;

    /**
     * 行业门类
     */
    private String cate;

    /**
     * 备注
     */
    @Excel(name = "备注")
    private String remark;

    @TableField(exist = false)
    private Map<String, Object> params = new HashMap<>();

    /**
     * 根据编码设置门类
     */
    public void initCateByCode() {
        this.cate = HangyeUtils.getCate(this.code);
    }
}
